import 'package:safetymonitor/app/core/core.dart';

/// 通用使用（隐患）
class BasicCommonDangerWidget {
  /// 获取隐患状态
  //       '待派发',
  //       '待整改',
  //       '整改中',
  //       '待验收',
  //       '逾期未整改',
  //       '逾期未派发',
  //       '已完成',
//    状态(1:待派发、2:待整改、3:整改中、4:待验收、5:逾期未整改、6:逾期未派发、7:已完成),示例值(1)
  static Widget getCommonStateView(int state) {
    String? stateText;
    Color? color;
    switch (state) {
      case 1:
        stateText = '待派发';
        color = const Color(0xFF8080FF);
        break;
      case 2:
        stateText = '待整改';
        color = const Color(0xFF108DE9);
        break;
      case 3:
        stateText = '整改中';
        color = const Color(0xFFF59B25);
        break;
      case 4:
      case 8:
        stateText = '待验收';
        color = const Color(0xFF290ED0);
        break;
      case 5:
        stateText = '逾期未整改';
        color = const Color(0xFFD9001B);
        break;
      case 6:
        stateText = '逾期未派发';
        color = const Color(0xFFD9001B);
        break;
      case 7:
        stateText = '已完成';
        color = const Color(0xFF000000);
        break;
    }
    return Container(
      alignment: Alignment.center,
      height: 18.w,
      width: 52.w,
      decoration: BoxDecoration(
        color: color ?? Colors.white,
        borderRadius: BorderRadius.only(
          topRight: Radius.circular(20.w),
          topLeft: Radius.circular(20.w),
          bottomRight: Radius.circular(20.w),
        ),
      ),
      child: Text(
        stateText ?? '',
        style: TextStyle(
          fontSize: 10.sp,
          fontWeight: FontWeight.w400,
          color: Colors.white,
        ),
      ),
    );
  }
}
